const Cache = require('../utils/cache')

/** token校验中间件 */
const tokenCheck = (req,res,next)=>{
    let token = req.header('x-token')
    if(!token || !Cache.has(token)) {
    	res.status(401)
    	res.send('未检测到登录用户，无法执行操作')
    	return;
    }
    next()
}

module.exports = tokenCheck